package com.framework.workflow.constant;

public interface DataDict {

    /**
     * 流程节点-节点类型
     */
    enum WfNodeType {
        COMMON("1", "普通节点"),
        SIGN("2", "同步会签"),
        SINGLE_SIGN("3", "会签节点"),
        END("4", "结束节点"),
        ;

        private final String code;

        private final String name;

        WfNodeType(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getName() {
            return this.name;
        }

        @Override
        public String toString() {
            return code;
        }
    };

    /**
     * 流程代理-代理状态
     */
    enum WfInsStatus {
        TO_START("0", "待审批"),
        RE_START("1", "重新发起"),
        RUNNING("2", "进行中"),
        END("3", "审核结束"),
        DELETED("4", "追回"),
        BACK("7", "退回"),
        STOP("5", "终止"),
        HAS_START("6", "已发起"),;

        private final String code;

        private final String name;

        WfInsStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public static WfInsStatus parse(String code) {
            for (WfInsStatus status : WfInsStatus.values()) {
                if (status.code.equals(code)) {
                    return status;
                }
            }

            return WfInsStatus.TO_START;
        }

        public String getName() {
            return this.name;
        }

        @Override
        public String toString() {
            return code;
        }
    };

    enum WfRejectStatus {
        AGREE("0", "同意"),
        REJECT("1", "驳回");

        private final String code;

        private final String name;

        WfRejectStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getName() {
            return this.name;
        }

        @Override
        public String toString() {
            return code;
        }
    };

    /**
     * 流程变量-流程变量名
     */
    enum WfVariableKey {
        FORCE_COMPLETE("forceComplete", "结束会签节点"),
        IS_REJECT("isReject", "是否驳回"),
        ENTITY("entity", "实体类"),
        ASSIGNEE("assignee", "指派人"),
        STOP_PROCESS("stop_process", "终止流程"),
        START_USER("startUser", "启动人"),
        REJECT_TO("to", "驳回目标节点");

        private final String code;
        private final String name;

        WfVariableKey(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getName() {
            return this.name;
        }

        public String getCode() {
            return code;
        }

        @Override
        public String toString() {
            return code;
        }
    };

    enum Separator {
        BPMN_Suffix("bpmn", "bpmn后缀"),
        POINT(".", "符号"),
        COMMA(",", "逗号");

        private final String code;
        private final String name;

        private Separator(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getName() {
            return this.name;
        }

        @Override
        public String toString() {
            return code;
        }
    };

    /**
     * 流程按钮
     */
    enum BtnStatus {
        SHOW("0", "查看"),
        EDIT("1", "修改"),
        DELETE("2", "删除"),
        APPLY("3", "提交"),
        APPROVE("4", "处理");

        private final String code;
        private final String name;

        private BtnStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getName() {
            return this.name;
        }

        @Override
        public String toString() {
            return code;
        }
    }
}
